package com.tang.excel.pa.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 协议类型
 *
 * @author liqilin
 * @since 2020/11/27 16:43
 */
public enum ProtocolType {

    /**
     * REST
     */
    REST(0, "REST"),

    /**
     * MQTT
     */
    MQTT(1, "MQTT");

    private int code;

    private String message;

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    ProtocolType(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private static final Map<Integer, ProtocolType> protocolTypeMap = new HashMap<>(8);

    static {
        for (ProtocolType protocolType : ProtocolType.values()) {
            protocolTypeMap.put(protocolType.getCode(), protocolType);
        }
    }

    public static Map<Integer, ProtocolType> getProtocolTypeMap() {
        return protocolTypeMap;
    }
}
